Page templates enable you to define templates for creating new pages. They can be invoked in a few ways:
Explicitly using the command
Explicitly using a custom command configured in the template
Implicitly when configured to be used automatically for a specific page prefix.
A page template is a template using the hooks.newPage attribute (in Frontmatter).
The following configuration options are supported:
suggestedName: the proposed name for the new page, can use template placeholders such as {{today}}.
confirmName: Confirm the suggested page name before creating it (defaults to true).
openIfExists: If a page with the suggestedName already exists, open it instead of overwriting it. This is useful to implement page templates like Daily Note.
forPrefix: automatically apply (or offer, when multiple page templates match) this page template for page names that start with this prefix.
key: Bind the snippet to a keyboard shortcut (note: this requires to also specify the command configuration).
mac: Bind the snippet to a Mac-specific keyboard shortcut.
An example:
--- tags: template hooks.newPage: suggestedName: "π " forPrefix: "π " --- # {{@page.name}} As recorded on {{today}}.
## Introduction ## Notes ## Conclusions
When using the command and selecting this template, this will prompt you to pick a page name (defaulting to βπ β), and then create the following page (on 2023-08-08) when you pick βπ Harry Potterβ as a page name:
# π Harry Potter As recorded on 2022-08-08.
## Introduction ## Notes ## Conclusions
In addition, this page template will be used automatically when you create any new page starting with βπ β by navigating to a new page matching this prefix, such as βπ Foundationβ.
As with any template, the frontmatter can be used to define Frontmatter for the new page.